<?php
namespace catchAdmin\disease\tables;

use catchAdmin\disease\tables\forms\Factory;
use catcher\CatchTable;
use catcher\library\table\Actions;
use catcher\library\table\HeaderItem;
use catcher\library\table\Search;

class Illness extends CatchTable
{
    protected function form()
    {
        // TODO: Implement form() method.
        return Factory::create('illness');
    }

    protected function table()
    {
        // TODO: Implement table() method.
        return $this->getTable('Illness')
                    ->header([
                        HeaderItem::label()->selection(),
                        HeaderItem::label('疾病编码')->prop('illnessno'),
                        HeaderItem::label('疾病代码')->prop('illnesscode'),
                        HeaderItem::label('疾病名称')->prop('name'),
                        HeaderItem::label('操作')->actions([
                            Actions::update(),
                            Actions::delete()
                        ])
                    ])
                    ->withActions([
                        Actions::create()
                    ])
                    ->withSearch([
                        Search::label('疾病名称')->text('name', '疾病名称'),
                        Search::label('疾病编码')->text('illnessno', '疾病编码'),
                    ])
                    ->withDialogWidth('35%')
                    ->withApiRoute('illness')
                    ->selectionChange()
                    ->render();
    }
}